<?php

class brand_model extends CI_Model
{
    private $items = 'items';
    protected $_table = "mock_brand";
    protected $_tableproduct = "mock_products";
    public function __construct(){
        parent::__construct();
    }
    public function listBrand($end,$start)
    {
        $this->db->limit($end,$start);
        return $this->db->get($this->_table)->result_array();

    }
    public function totalBrand()
    {
        return $this->db->count_all($this->_table);
    }
    public function GetData($id)
    {
        $this->db->where("brand_id",$id);
        return $this->db->get($this->_table)->row_array();
    }
    function get_item_list()
    {
        $this->db->orderby('brand_name','ASC');
        return $this->db->get($this->_table)->result_array();
    }
    public function delBrand($id){
        $this->db->where("brand_id",$id);
        $this->db->delete($this->_table);
    }
    public function delProduct($id){
        $this->db->where("brand_id",$id);
        $this->db->delete($this->_tableproduct);
    }

    public function listBran_product(){
        return $this->db->get($this->_table)->result_array();
    }

}